<?php

class ProductFileUploadsForm extends sfForm
{

  protected $product;
 
  public function __construct(Product $product)
  {
    $this->product = $product;
 
    parent::__construct();
  }


  public function configure()
  {   	
  	$product_pictures = $this->product->getPictures();
    for($i=0; $i<sfConfig::get('sf_attachments'); $i++) 
    {
    	if (isset($product_pictures[$i])){
    		$this->embedForm($i, new ProductPictureForm($product_pictures[$i]));	
    	}else{
    		$this->embedForm($i, new ProductPictureForm());
    	}
      
    }
  }

}